package fs.tileMap {
	import flash.display.DisplayObject;
	import flash.display.MovieClip;
	import flash.display.Sprite;
	import flash.geom.Point;
	import flash.geom.Rectangle;
	
	/**
	 * ...
	 * @author flyingSnow
	 */
	public class Character extends Sprite {	
		private var _v:Point=new Point();
		private var _a:Point = new Point();
		private var _maxSpeed:Number = 10;
		private var _hitFlag:int;
		private var _hitBounds:Rectangle=new Rectangle();
		//private var _hitArea:MovieClip;
		
		public function Character() {
			//graphics.lineStyle(0);
			//graphics.beginFill(0x00ff00);
			//graphics.drawRect(0, 0, 30, 50);
			//graphics.endFill();
			//_hitArea = this["hit_area"];
		}
		
		public function getHitBounds(target:DisplayObject):Rectangle {
			return getBounds(target);
		}
		public function get correctX():Number {
			return 0;
		}
		public function get correctY():Number {
			return 0;
		}
		//public function clearHitFlags():void {
			//if (_v.x > 0) {
				//_hitFlag &= (~8);
			//}else if (_v.x < 0) {
				//_hitFlag &= (~2);
			//}
			//
			//if (_v.y > 0) {
				//_hitFlag &= (~1);
			//}else if (_v.y < 0) {
				//_hitFlag &= (~4);
			//}
			//_hitFlag = 0;
		//}
		
		public function get a():Point {
			return _a;
		}
		
		public function get hitFlag():int {
			return _hitFlag;
		}
		
		public function set hitFlag(value:int):void {
			_hitFlag = value;
		}
		
		public function get v():Point {
			return _v;
		}
		
		public function set v(value:Point):void {
			_v = value;
			if (value.x > Math.abs(_maxSpeed)) {
				value.x = Math.abs(value.x) / value.x * Math.abs(_maxSpeed);
			}
			if (value.y > Math.abs(_maxSpeed)) {
				value.y = Math.abs(value.y) / value.y * Math.abs(_maxSpeed);
			}
		}
		
		public function get maxSpeed():Number {
			return _maxSpeed;
		}
		
		public function set maxSpeed(value:Number):void {
			_maxSpeed = value;
		}
		
		public function get hitBounds():Rectangle {
			return _hitBounds;
		}
		public function get parentHitBounds():Rectangle {
			var res:Rectangle = _hitBounds.clone();
			res.x += x;
			res.y += y;
			return res;
		}
		
		
		
		override public function get height():Number {
			return super.height;
		}
		
		override public function set height(value:Number):void {
			super.height = value;
		}
		
		
		
		override public function get width():Number {
			return super.width;
		}
		
		override public function set width(value:Number):void {
			super.width = value;
		}
	}

}